//related to badgeround.ui
var root = ui("$");
var nf = sm("do_Notification");
var bgmask = ui("maskbg");
var gridMenu = ui("gridMenu");
var closeMenu = ui("closeMenu");

//遮罩显示
var animMaskShow = mm("do_Animator");
var propsMS = {bgColor:"000000dd"};
animMaskShow.append(320,propsMS,"EaseOut");
//面板显示
var animPanelShow = mm("do_Animator");
var propsPS = {y:0,alpha:1};
animPanelShow.append(640,propsPS,"EaseOut");

//遮罩隐藏
var animMaskHide = mm("do_Animator");
var propsMH = {bgColor:"00000000"};
animMaskHide.append(320,propsMH,"EaseOut");
//面板隐藏
var animPanelHide = mm("do_Animator");
var propsPH = {y:460,alpha:0.8};
animPanelHide.append(320,propsPH,"EaseOut");

var page = sm("do_Page");
//自定义事件---打开
root.on("mainMenuSJ",function(data){
	bgmask.visible = true;
	bgmask.animate(animMaskShow);
	gridMenu.animate(animPanelShow);
    gridMenu.items = data;
});
//遮罩事件
bgmask.on("touch","",300,function(){
	mainCloseBox();
});

closeMenu.on("touch","",300,function(){
	mainCloseBox();
});
function mainCloseBox(){
	bgmask.animate(animMaskHide,function(){
		bgmask.visible = false;
	});
	gridMenu.animate(animPanelHide);
}
//订阅GridView的touch点击事件
gridMenu.on("touch", function(data) {
	mainCloseBox();
	root.fire("mainMenuItem",data);
})